package com.scalar.chiptrack.sales.forms.quote;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.scalar.chiptrack.ChipTrackActionForm;
import com.scalar.chiptrack.utils.StringUtils;


/**
 * Form bean for the customer_list page.  This form has the following fields,
 * with default values in square brackets: * <ul> *
 * <li><b>action</b> - The maintenance action we are performing (Create, Delete,  or Edit).
 * <li><b>customer name</b> - The customer name for the search.  [OPTIONAL]
 * </ul>
 *
 * @author Basha
 * @version
 */


public final class QuoteSearchForm extends ChipTrackActionForm {


    private int customerId              = -1;

    private String customerName         = null;
    private String marketingPartNo      = null;
    private String manufacturingPartNo  = null;
    private String quotationId          = null;
    private String fromDate             = null;
    private String toDate               = null;
    private String byDate               = null;
    private String quotationNo          = null;
    private String status               = null;
    private String customerPO           = null;
    private String endUser              = null;

    public QuoteSearchForm()
    {

    }

    /**
     * @return customerName
     */
    public String getCustomerName() {

	return customerName;

    }


    /**
     * Set the customername
     *
     * @param customerName
     */
    public void setCustomerName(String customerName) {

        this.customerName = customerName;

    }

    public int getCustomerId()
    {
        return customerId;
    }

    public void setCustomerId(int customerId)
    {
        this.customerId = customerId;
    }

    public String getMarketingPartNo()
    {
        return marketingPartNo;
    }

    public void setMarketingPartNo(String marketingPartNo)
    {
        this.marketingPartNo = marketingPartNo;
    }

    public String getManufacturingPartNo()
    {
        return manufacturingPartNo;
    }

    public void setManufacturingPartNo(String manufacturingPartNo)
    {
        this.manufacturingPartNo = manufacturingPartNo;
    }

    public String getQuotationId()
    {
        return quotationId;
    }

    public void setQuotationId(String quotationId)
    {
        this.quotationId = quotationId;
    }

    public String getFromDate()
    {
        return fromDate;
    }

    public void setFromDate(String fromDate)
    {
        this.fromDate = fromDate;
    }

    public String getToDate()
    {
        return toDate;
    }

    public void setToDate(String toDate)
    {
        this.toDate = toDate;
    }

    public String getByDate()
    {
        return byDate;
    }

    public void setByDate(String byDate)
    {
        this.byDate = byDate;
    }

    //For taxes
    private String salesTaxType = null;
    private float subTotal = 0.0f;
    private float salesTax = 0.0f;
    private float frieght = 0.0f;
    private float misc = 0.0f;
    private float orderTotal = 0.0f;

    public String getSalesTaxType()
    {
        return salesTaxType;
    }

    public void setSalesTaxType(String salesTaxType)
    {
        this.salesTaxType = salesTaxType;
    }

    public float getSubTotal()
    {
        return subTotal;
    }

    public String getSubTotalAsString()
    {
        return StringUtils.formatAmountWithNoOfDecimals(subTotal);
    }

    public void setSubTotal(float subTotal)
    {
        this.subTotal = subTotal;
    }

    public float getSalesTax()
    {
        return salesTax;
    }

    public String getSalesTaxAsString()
    {
        return StringUtils.formatAmountWithNoOfDecimals(salesTax);
    }

    public void setSalesTax(float salesTax)
    {
        this.salesTax = salesTax;
    }

    public String getFrieghtAsString()
    {
        return StringUtils.formatAmountWithNoOfDecimals(frieght);
    }

    public float getFrieght()
    {
        return frieght;
    }

    public void setFrieght(float frieght)
    {
        this.frieght = frieght;
    }

    public String getMiscAsString()
    {
        return StringUtils.formatAmountWithNoOfDecimals(misc);
    }

    public float getMisc()
    {
        return misc;
    }

    public void setMisc(float misc)
    {
        this.misc = misc;
    }

    public float getOrderTotal()
    {
        return orderTotal;
    }

    public String getOrderTotalAsString()
    {
        return StringUtils.formatAmountWithNoOfDecimals(orderTotal);
    }

    public void setOrderTotal(float orderTotal)
    {
        this.orderTotal = orderTotal;
    }

	public String getQuotationNo()
    {
        return quotationNo;
    }

    public void setQuotationNo(String quotationNo)
    {
        this.quotationNo = quotationNo;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status)
    {
        this.status = status;
    }

    public String getCustomerPO() {
        return customerPO;
    }

    public void setCustomerPO(String customerPO) {
        this.customerPO = customerPO;
    }

    public String getEndUser() {
        return endUser;
    }

    public void setEndUser(String endUser) {
        this.endUser = endUser;
    }

    /**
     * Reset all properties to their default values.
     *
     * @param mapping The mapping used to select this instance
     * @param request The servlet request we are processing
     */
    public void reset(ActionMapping mapping, HttpServletRequest request) {

            //Need to try...

    }


    /**
     * Validate the properties that have been set from this HTTP request,
     * and return an <code>ActionErrors</code> object that encapsulates any
     * validation errors that have been found.  If no errors are found, return
     * <code>null</code> or an <code>ActionErrors</code> object with no
     * recorded error messages.
     *
     * @param mapping The mapping used to select this instance
     * @param request The servlet request we are processing
     */
    public ActionErrors validate(ActionMapping mapping,
                                 HttpServletRequest request) {

        ActionErrors errors = new ActionErrors();

        return errors;

    }
}
